<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>无标题文档</title>
	<link href="/static/css/default.css" rel="stylesheet" type="text/css">
	<link href="/static/css/style/green.css" rel="stylesheet" type="text/css" id='link'>
	<link href="/static/js/datepicker/css/bootstrap-datepicker.css" rel="stylesheet">
</head>

<body style="padding:15px 8px 0px 8px;">



	<div class="classify">{$parenttitle}</div>
	<!--toolbar start-->
	<ul class="toolbar">
		<li><a href="#" class="selected" id="add"><i class="toolico iconfont">&#xe649;</i>添加</a></li>

		<li><a href="#" class="selected" id="import">导入数据</a></li>

	</ul>
	<!--toolbar end-->

	<!--tablebox start-->
	<div class="tablebox" id="main">

		<table>

			<thead>
				<th class="num"></th>
				<th>姓名</th>
				<th>手机</th>
				<th>性别</th>
				<th>身份证</th>
				<th>毕业院校</th>
				<th>参加工作时间</th>
				<th>离职时间</th>
				<th>紧急联系电话</th>
				<th>是否绑定</th>
				<th>是否园长</th>
				<th>操作</th>
			</thead>

			<tbody>


				<tr v-for="uitem in arrayData">
					<td><input type="checkbox"></td>

					<td>{{uitem.teachername}}</td>
					<td>{{uitem.phone}}</td>
					<td>{{uitem.sex}}</td>
					<td>{{uitem.idcard}}</td>
					<td>{{uitem.overschool}}</td>
					<td>{{uitem.jointime}}</td>
					<td>{{uitem.outtime}}</td>
					<td>{{uitem.otherphone}}</td>
					<td>
						{{uitem.isbind}}
					</td>
					<td>
						<span v-if="uitem.isyuanzhang=='1'">是</span>
						<span v-else>否</span>
					</td>
					<td>
						<div class="am-btn-toolbar">
							<div class="am-btn-group am-btn-group-xs">
								<a v-on:click="myclass(uitem)">关联班级</a>
								<a v-if="uitem.isbind==='是'" v-on:click="jiebang(uitem)">解绑</a>
								<span v-else></span>
								<a v-on:click="vupdate(uitem)">修改</a>
								<a v-on:click="vdel(uitem)">删除</a>
								<a v-on:click="yuanzhang2(uitem)" v-if="uitem.isyuanzhang===1">取消园长</a>
								<a v-on:click="yuanzhang1(uitem)" v-else>设为园长</a>
							</div>
						</div>
					</td>
				</tr>
				</tr>



			</tbody>

		</table>

		<div class="pagination">

			<!-- <li><a href="#" class="first">首页</a></li> -->
			<!-- <li><a href="#" class="selected pageico"><i class="iconfont">&#xe61f;</i></a></li> -->
			<!-- <li><a href="#">1</a></li> -->
			<!-- <li><a href="#">2</a></li> -->
			<!-- <li><a href="#">3</a></li> -->
			<!-- <li><a href="#">4</a></li> -->
			<!-- <li><a href="#">5</a></li> -->
			<!-- <li><a href="#">6</a></li> -->
			<!-- <li><a href="#">7</a></li> -->
			<!-- <li><a href="#">8</a></li> -->
			<!-- <li><a href="#">9</a></li>     -->

			<!-- <li><a href="#">尾页</a></li> -->
			<vue-nav :cur="cur" :all="all" :allcount="allcount" :callback="callback"></vue-nav>




		</div>
	</div>
	<!--tablebox end-->

	<!--pagination start-->


	<!--pagination end-->

</body>
<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>

<script src="/static/js/layer/layer.js"></script>

<script type="text/javascript" src="/static/js/vue2.js"></script>
<script type="text/javascript" src="/static/js/vue-nav.js"></script>
<script>
	var vm = new Vue({
		el: "#main",
		data: {
			cur: 1,
			all: 0,
			size: 10,
			allcount: 0,
			arrayData: [],

		},
		components: {
			'vue-nav': Vnav
		},
		methods: {
			getdata: function (_keycontent) {  //查询数据

				var self = this;
				$.get("/Index/Teacher/GetTeacher", { page: self.cur, size: self.size }, function (_result) {
					self.arrayData = _result.list;
					self.all = _result.count;
					self.allcount = _result.allcount
				});

			},
			callback: function (data) {

				var self = this;
				this.cur = data;

				$.get("/Index/Teacher/GetTeacher", { page: self.cur, size: self.size }, function (_result) {

					self.arrayData = _result.list;
					self.all = _result.count;
					self.allcount = _result.allcount
				});
			},
			myclass:function(uitem){
				
				parent.layer.open({
					type: 2,
					title: '班级关联',
					fixed: false, //不固定
					maxmin: true,
					area: ['600px', '550px'],
					content: '/Index/Teacher/myclass?id=' + uitem.id
				});

			},
			yuanzhang1: function (uitem) {
				var self = this;
				parent.layer.confirm('确定要设置为园长吗?', {
					btn: ['是', '否'] //按钮
				}, function () {
					$.post("/Index/Teacher/yuanzhangset", { "id": uitem.id,"state":1 }, function (data) {
						parent.layer.closeAll('dialog');
						if (data.status == 200) {
							layer.msg(data.message);
							self.getdata("");
						} else {
							layer.msg(data.message);
						}
					});
				}, function () {

				});

			},
			yuanzhang2: function (uitem) {
				var self = this;
				parent.layer.confirm('确定要取消园长吗?', {
					btn: ['是', '否'] //按钮
				}, function () {
					$.post("/Index/Teacher/yuanzhangset", { "id": uitem.id,"state":0 }, function (data) {
						parent.layer.closeAll('dialog');
						if (data.status == 200) {
							layer.msg(data.message);
							self.getdata("");
						} else {
							layer.msg(data.message);
						}
					});
				}, function () {

				});

			},
			jiebang: function (uitem) {
				var self = this;
				parent.layer.confirm('确定要解绑吗?', {
					btn: ['是', '否'] //按钮
				}, function () {
					$.post("/Index/Teacher/jiebang", { "id": uitem.id }, function (data) {
						parent.layer.closeAll('dialog');
						if (data.status == 200) {
							layer.msg(data.message);
							self.getdata("");
						} else {
							layer.msg(data.message);
						}
					});
				}, function () {

				});

			},
			vupdate: function (uitem) {

				//***************获取数据的方法1，使用jquery获取*****************

				parent.layer.open({
					type: 2,
					title: '菜单信息修改',
					fixed: false, //不固定
					maxmin: true,
					area: ['600px', '450px'],
					content: '/Index/Teacher/Add?id=' + uitem.id
				});

			},
			vdel: function (uitem) {
				var self = this;
				parent.layer.confirm('确定要删除吗?', {
					btn: ['是', '否'] //按钮
				}, function () {
					$.post("/Index/Teacher/Del", { "id": uitem.id }, function (data) {
						parent.layer.closeAll('dialog');
						if (data.status == 200) {
							layer.msg(data.message);
							self.getdata("");
						} else {
							layer.msg(data.message);
						}
					});
				}, function () {

				});

			}
		},
		created: function () {  //初始化事件里边去调用查询方法
			this.getdata("");
		}
	});

	$(function () {
		$('#add').on('click', function () {

			parent.layer.open({
				title: '信息添加',
				type: 2,
				area: ['600px', '450px'],
				fixed: false, //不固定
				maxmin: true,
				content: '/Index/Teacher/Add'
			});
		});
		$('#import').on('click', function () {

			parent.layer.open({
				title: '数据导入',
				type: 2,
				area: ['800px', '650px'],
				fixed: false, //不固定
				maxmin: true,
				content: '/Index/Home/import'
			});
		});

	})
</script>

</html>